package com.ny.demo0428;

public class InsuranceTest {
    public static void main(String[] args) {
        // 多态：父类引用指向子类对象
        Insurance car = new CarInsurance(200000, 1);  // 车险：价值20万，1次事故
        Insurance home = new HomeInsurance(500000, 120); // 家险：价值50万，面积120㎡

        // 统一调用calculatePremium()，实际执行子类逻辑
        System.out.println("车险保费: " + car.calculatePremium());
        System.out.println("家庭险保费: " + home.calculatePremium());
    }
}
